package com.qcxk.yuqian.system.component.exception;

import com.alibaba.fastjson.JSONObject;
import lombok.extern.slf4j.Slf4j;
import org.apache.logging.log4j.Logger;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;

@ControllerAdvice
@ResponseBody
@Slf4j
public class WebExceptionHandler {

    @ExceptionHandler
    public JSONObject unknownException(Exception e) {
        log.error("发生了未知异常", e);
        return ResultBean.error("系统出现错误, 请联系网站管理员!");
    }
}
